use crate::context::Context;
use crate::message::{Message, Hello};

// 定义 Actor trait
pub trait Actor {
    fn receive(&mut self, context: &Context<impl MessageReceiver>, msg: Box<dyn Message>);
}

// 实现 HelloActor
pub struct HelloActor;

impl Actor for HelloActor {
    fn receive(&mut self, _context: &Context<impl MessageReceiver>, msg: Box<dyn Message>) {
        if let Some(hello) = msg.downcast_ref::<Hello>() {
            println!("Hello {}", hello.who);
        }
    }
}